import Vue from 'vue'
import VueRouter from 'vue-router'

// import Test from '../containers/test.vue'
// 公共部分(登陆、单点登录、导航、路由中间件)
import Login from '../containers/basics/login.vue'
import Singlelogin from '../containers/basics/blankPage/blankPage.vue'
import Timeout from '../containers/basics/timeout.vue'
import Layout from '../containers/basics/layout'
import middle from '../containers/basics/middle.vue'
import beforeComponent from '../containers/basics/beforeComponent.vue'
import Jump from '../containers/basics/jump.vue'

// 系统监测--监测日志、事件管理、安全分析、风险事项、风险预警
// 监测日志
import safeEvents from '../containers/monitor/safeEvents/safeEvents.vue'
import safeEventsDetail from '../containers/monitor/safeEvents/safeEventsDetail.vue'
import eventManagement from '../containers/monitor/eventManagement/eventManagement.vue'
import eventManagementDetail from '../containers/monitor/eventManagement/eventManagementDetail.vue'
import riskEvents from '../containers/monitor/riskEvents/riskevent.vue'
import riskDetails from '../containers/monitor/riskEvents/riskDetails.vue'
import riskwarning from '../containers/monitor/warning/riskwarning.vue'
import warningdetails from '../containers/monitor/warning/riskwarningDetails.vue'
// 统计管理--安全状态画像、报表报告)
// 安全分析
import Analyze from '../containers/monitor/analyze/index.vue'
import autoAnalyzeRule from '../containers/monitor/analyze/autoAnalyzeRule.vue'

// 统计管理--安全状态画像、报表报告)
import safePortrait from '../containers/statistics/safePortrait/safePortrait.vue'
import portraitHead from '../containers/statistics/safePortrait/portraitHead.vue'
import reportForms from '../containers/statistics/report/reportForms.vue'
import safetyForm from '../containers/statistics/report/safeReportTable.vue'

// 业务管理--基础信息管理(机构管理、信息系统管理、系统节点管理)、任务管理、权限管理(角色管理、用户管理、用户组管理)、操作日志

import attackDepthAnalysis from '../containers/monitor/analyze/attackDepthAnalysis.vue'
import analysisReport from '../containers/monitor/analyze/analysisReport.vue'

// 业务管理--基础信息管理(机构管理、信息系统管理、系统节点管理)、任务管理、权限管理(角色管理、用户管理、用户组管理)、操作日志
// 机构管理
import mechanism from '../containers/business/basics/mechanisms/mechanism.vue'
import syncmechanism from '../containers/business/basics/mechanisms/syncMechanisms.vue'
import mechanismLog from '../containers/business/basics/mechanisms/syncLog.vue'
// 信息系统
import informationSystem from '../containers/business/basics/informationSystem/informationSystem.vue'
import antoSystem from '../containers/business/basics/informationSystem/antoSystem.vue'
import historySystem from '../containers/business/basics/informationSystem/historySystem.vue'
// 系统节点
import systemNode from '../containers/business/basics/systemNode/systemNode.vue'
import antosystemNode from '../containers/business/basics/systemNode/antosystemNode.vue'
import historySystemNode from '../containers/business/basics/systemNode/historysystemNode.vue'
// 操作日志
import operate from '../containers/business/logger/operatelog.vue'
import taskManagement from '../containers/business/task/taskManagement.vue'
import taskManagementLog from '../containers/business/task/taskManagementLog/taskManagementLog.vue'
import taskflow from '../containers/business/task/taskManagementLog/taskflow.vue'
// 用户管理
// import addUser from '../containers/business/permissions/userCtrl/addUser.vue'
import userSyn from '../containers/business/permissions/userCtrl/userSynchro.vue'
// import updateUser from '../containers/business/permissions/userCtrl/updateUser.vue'
import synchronization from '../containers/business/permissions/userCtrl/synchronization.vue'
import users from '../containers/business/permissions/userCtrl/users.vue'
import userDetail from '../containers/business/permissions/userCtrl/newdetailed.vue'
// 角色管理
import role from '../containers/business/permissions/role/role.vue'
import changeInfo from '../containers/business/permissions/role/changeInfo.vue'
import roleHistory from '../containers/business/permissions/role/roleHistory.vue'
// 用户组管理
import usersCtrl from '../containers/business/permissions/group/newusersCtrl.vue'
// import addgroup from '../components/group/addgroup.vue'
// import updategroup from '../components/group/updategroup.vue'
import groupSync from '../containers/business/permissions/group/groupSync.vue'
import groupLog from '../containers/business/permissions/group/synclog.vue'
// 运行管理--运行监控
import operationMonitor from '../containers/operationMonitor/operationMonitor.vue'

Vue.use(VueRouter)
let router = new VueRouter({
  routes: [{
    path: '/',
    component: Layout,
    children: [{
      path: 'monitor',
      name: '系统监测',
      component: middle,
      children: [
        {
          path: 'event',
          component: middle,
          children: [{
            path: '/',
            name: '事件管理',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@事件管理',
              component: eventManagement
            }, {
              path: 'eventManagementDetail',
              name: '事件管理详情',
              component: eventManagementDetail
            }
            ]
          }]
        },
        {
          path: 'analyze',
          component: middle,
          children: [{
            path: '/',
            name: '安全分析',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@安全分析',
              component: Analyze
            }, {
              path: 'autoAnalyzeRule',
              name: '规则配置',
              component: autoAnalyzeRule
            }, {
              path: 'attackDepthAnalysis',
              name: '深度分析',
              component: attackDepthAnalysis
            }, {
              path: 'analyzeDetail',
              name: '分析详情',
              component: eventManagementDetail
            }, {
              path: 'analysisReport',
              name: '分析报告',
              component: analysisReport
            }]
          }]
        },
        {
          path: 'riskEvents',
          component: middle,
          children: [{
            path: '/',
            name: '风险事项',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@风险事项',
              component: riskEvents
            },
            {
              path: 'riskDetails',
              name: '风险事项详情',
              component: riskDetails
            }]
          }]
        },
        {
          path: 'warning',
          component: middle,
          children: [{
            path: '/',
            name: '风险预警',
            component: beforeComponent,
            children: [
              {
                path: '/',
                name: '@风险预警',
                component: riskwarning
              },
              {
                path: 'details',
                name: '风险预警详情',
                component: warningdetails
              }]
          }]
        },
        {
          path: 'log',
          name: '监测日志',
          component: middle,
          children: [{
            path: 'attack',
            name: '攻击',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@攻击',
              component: safeEvents
            },
            {
              path: 'attackDetail/:id',
              name: '攻击详情',
              component: safeEventsDetail
            }
            ]
          },
          {
            path: 'vul',
            name: '脆弱性',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@脆弱性',
              component: safeEvents
            },
            {
              path: 'vulDetail/:id',
              name: '脆弱性详情',
              component: safeEventsDetail
            }
            ]
          },
          {
            path: 'audit',
            name: '异常',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@异常',
              component: safeEvents
            },
            {
              path: 'auditDetail/:id',
              name: '异常详情',
              component: safeEventsDetail
            }
            ]
          },
          {
            path: 'visible',
            name: '运行状态',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@运行状态',
              component: safeEvents
            },
            {
              path: 'visibleDetail/:id',
              name: '运行状态详情',
              component: safeEventsDetail
            }
            ]
          },
          {
            path: 'all',
            name: '全部',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@全部',
              component: safeEvents
            },
            {
              path: 'allDetail/:id',
              name: '全部详情',
              component: safeEventsDetail
            }
            ]
          }
          ]
        }
      ]
    },
    {
      path: 'statistic',
      name: '统计管理',
      component: middle,
      children: [
        {
          path: 'safetyProfile',
          component: middle,
          children: [{
            path: '/',
            name: '安全状态画像',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@安全状态画像',
              component: portraitHead
            },
            {
              path: 'safetyProhome/:safewebsite_id',
              name: '安全详情',
              component: safePortrait
            }]
          }]
        },
        {
          path: 'reports',
          name: '报表报告',
          component: middle,
          children: [{
            path: 'safetyForm',
            name: '安全报表',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@安全报表',
              component: safetyForm
            }]
          }, {
            path: 'safetyReport',
            name: '安全报告',
            component: beforeComponent,
            children: [{
              path: '/',
              name: '@安全报告',
              component: reportForms
            }]
          }]
        }]
    },
    {
      path: 'business',
      name: '业务管理',
      component: middle,
      children: [{
        path: 'basics',
        name: '基础信息管理',
        component: middle,
        children: [{
          path: 'mechanism',
          name: '机构管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@机构管理',
            component: mechanism
          },
          {
            path: 'syncmechanism',
            name: '同步信息',
            component: syncmechanism
          },
          {
            path: 'synclog',
            name: '历史信息',
            component: mechanismLog
          }]
        },
        {
          path: 'informationSystem',
          name: '信息系统管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@信息系统管理',
            component: informationSystem
          },
          {
            path: 'antoSystem',
            name: '同步信息',
            component: antoSystem
          },
          {
            path: 'historySystem',
            name: '历史信息',
            component: historySystem
          }]
        },
        {
          path: 'systemNode',
          name: '系统节点管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@系统节点管理',
            component: systemNode
          },
          {
            path: 'antosystemNode',
            name: '同步信息',
            component: antosystemNode
          },
          {
            path: 'historySystemNode',
            name: '历史信息',
            component: historySystemNode
          }]
        }
        ]
      },
      {
        path: 'task',
        component: middle,
        children: [{
          path: '/',
          name: '任务管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@任务管理',
            component: taskManagement
          },
          {
            path: 'taskFeedBack/:id',
            name: '任务反馈',
            component: taskManagementLog
          },
          {
            path: 'taskflow/:id',
            name: '任务反馈',
            component: taskflow
          },
          {
            path: 'taskFeedBackDetail/:id',
            name: '反馈详情',
            component: safeEventsDetail
          }]
        }]
      },
      {
        path: 'auth',
        name: '权限管理',
        component: middle,
        children: [{
          path: 'role',
          name: '角色管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@角色管理',
            component: role
          },
          {
            path: 'changeInfo',
            name: '角色变更信息列表',
            component: changeInfo
          },
          {
            path: 'roleHistory',
            name: '角色变更历史列表',
            component: roleHistory
          }
          ]
        },
        {
          path: 'group',
          name: '用户组管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@用户组管理',
            component: usersCtrl
          },
          // {
          //   path: 'addgroup',
          //   name: '新增用户组',
          //   component: addgroup
          // },
          // {
          //   path: 'upgroup/:data',
          //   name: '修改用户组',
          //   component: updategroup
          // },
          {
            path: 'syncgroup',
            name: '同步用户组',
            component: groupSync
          },
          {
            path: 'syncgroupLog',
            name: '同步用户组历史',
            component: groupLog
          }

          ]
        },
        {
          path: 'user',
          name: '用户管理',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '@用户管理',
            component: users
          },
          // {
          //   path: 'add',
          //   name: '新增用户信息',
          //   component: addUser
          // },
          // {
          //   path: 'update/:data',
          //   name: '修改用户信息',
          //   component: updateUser
          // },
          {
            path: 'details/:data',
            name: '详细用户信息',
            component: userDetail
          },
          {
            path: 'userSyn',
            name: '用户同步',
            component: userSyn
          },
          {
            path: 'synclog',
            name: '用户同步历史信息',
            component: synchronization
          }
          ]
        }
        ]
      },
      {
        path: '/',
        component: middle,
        children: [{
          path: 'logger',
          component: beforeComponent,
          children: [{
            path: '/',
            name: '操作日志',
            component: operate
          }]
        }]
      }
      ]
    },
    {
      path: 'operation',
      name: '运行管理',
      component: middle,
      children: [{
        path: '/',
        component: middle,
        children: [{
          path: '/',
          component: beforeComponent,
          children: [{
            path: 'monitor',
            name: '运行监控',
            component: operationMonitor
          }]
        }]
      }]
    }],
    beforeEnter: (to, from, next) => {
      if (to.path === '/') next('/jump')
      else next()
    }
  },
  {
    path: '/login',
    name: '登录',
    component: Login
  },
  {
    path: '/singleLogin',
    name: '单点登录',
    component: Singlelogin
  },
  {
    path: '*'
  },
  {
    path: '/timeout',
    name: '登录',
    component: Timeout
  },
  {
    path: '/jump',
    name: '跳转',
    component: Jump
  }
  ]
})
export default router
